package com.binyouwei.designpatterns.creation_type.prototype;

/**
 * @author 宾有为
 * @date 2024/6/24 19:51
 * @link https://blog.csdn.net/baidu_41616022?type=blog
 * @describe：创建一个实现 Cloneable 接口的抽象类
 **/
public abstract class PrototypeShape implements Cloneable{
    private String id;
    protected String type;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    abstract void draw();

    @Override
    protected Object clone() {
        Object clone = null;
        try {
            clone = super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return clone;
    }
}
